package com.warehouse.module.business.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author liutao
 * @version 1.0
 * @description: 货物订单状态枚举
 * @date 2024/7/22 11:44
 */
@Getter
@AllArgsConstructor
public enum OrderStatusEnum {
    PENDING_ENTRY(1, "待入仓"),
    PENDING_PACK(2, "待包装"),
//    RELEASE_CHECK(3, "包装审核"),
    PENDING_RELEASE(3, "待出仓"),
    PENDING_CHECK(4, "待安检"),
    PENDING_CUSTOMS(5, "待报关"),
    PENDING_SUBMISSION(6, "待交单"),
    TRANSIT(7, "运输中"),
    FINISHED(8, "已完成"),
    ;

    private final Integer status;
    private final String name;


    public static OrderStatusEnum getNameByStatus(Integer status){
        OrderStatusEnum[] arr = OrderStatusEnum.values();
        List<OrderStatusEnum> list = Arrays.asList(arr);
        List<OrderStatusEnum> res = list.stream().filter(it-> it.getStatus().equals(status)).collect(Collectors.toList());
        if(res.size() > 0){
            return res.get(0);
        }else{
            return null;
        }
    }
}
